package com.snailct.bpp.service.core.definition;



import com.snailct.bpp.db.MyBatisPojo;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by huangxa on 2016/7/13.
 */
public  class DefaultServiceDefinition extends MyBatisPojo implements ServiceDefinition {
    protected String serviceId;
    private String component;//组件名称，spring　bean名称
    protected String methodName;
    private String serviceAddr;
    private ServiceType serviceType;
    private String reqType;
    private String rtnType;
    protected String sendBody;
    private String rmk;
    protected List<ServiceMeta> serviceMetas = new ArrayList<ServiceMeta>();

    public List<ServiceMeta> getServiceMetas() {
        return serviceMetas;
    }

    public void setServiceMetas(List<ServiceMeta> serviceMetas) {
        this.serviceMetas = serviceMetas;
    }

    public String getSendBody() {
        return sendBody;
    }

    public void setSendBody(String sendBody) {
        this.sendBody = sendBody;
    }
    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    public ServiceType getServiceType() {
        return serviceType;
    }

    public void setServiceType(ServiceType serviceType) {
        this.serviceType = serviceType;
    }

    public String getServiceId() {
        return serviceId;
    }

    public String getRmk() {
        return rmk;
    }

    public void setRmk(String rmk) {
        this.rmk = rmk;
    }
    public String getRtnType() {
        return rtnType;
    }

    public void setRtnType(String rtnType) {
        this.rtnType = rtnType;
    }

    public void addServiceMeta(ServiceMeta serviceMeta){
        this.serviceMetas.add(serviceMeta);
    }

    public String getServiceAddr() {
        return serviceAddr;
    }

    public void setServiceAddr(String serviceAddr) {
        this.serviceAddr = serviceAddr;
    }
    public boolean validate(){
        if(serviceType == null){
            return false;
        }
        return true;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public String getReqType() {
        return serviceType.name();
    }

    public void setReqType(String reqType) {
        this.reqType = reqType;
    }
}
